import {
  Mail,
  MessageSquare,
  CheckSquare,
  Calendar,
  FileText,
  Circle,
  ShoppingCart,
  User,
  Shield,
  Users,
  Inbox,
  Lock,
  Star,
  Dribbble,
} from 'react-feather'

export let data

// ** Get initial Data
data = [
  {
    id: '1',
    name: '用户管理',
    path: '/user/manage',
    icon: 'User',
    status: '正常',
    sort: 1,
  },
  {
    id: '2',
    name: '角色管理',
    path: '/role/manage',
    status: '正常',
    sort: 2,
    icon: 'Users',
  },
  {
    id: '3',
    name: '菜单管理',
    icon: 'Inbox',
    sort: 3,
    status: '正常',
    path: '/menu/manage',
  },
]

const statusEnum = {
  0: '#ea5455',
  1: '#56affd',
}
const MenuEnum = {
  User: <User size={20} />,
  Users: <Users size={20} />,
  Inbox: <Inbox size={20} />,
  Mail: <Mail size={20} />,
  MessageSquare: <MessageSquare size={20} />,
  CheckSquare: <CheckSquare size={20} />,
  Calendar: <Calendar size={20} />,
  FileText: <FileText size={20} />,
  Circle: <Circle size={20} />,
  ShoppingCart: <ShoppingCart size={20} />,
  Shield: <Shield size={20} />,
  Lock: <Lock size={20} />,
  Star: <Star size={20} />,
  Dribbble: <Dribbble size={20} />,
}

// ** Table Common Column
export const columns = (handleEdit, handleDelete) => [
  {
    name: '行号',
    minWidth: '100px',
    cell: (row, a) => a + 1,
  },
  {
    name: '菜单名称',
    minWidth: '150px',
    selector: (row) => row.name,
  },
  {
    name: '组件路径',
    minWidth: '150px',
    selector: (row) => row.path,
  },
  {
    name: '图标',
    minWidth: '150px',
    selector: (row) => MenuEnum[row.icon],
  },
  {
    name: '排序',
    minWidth: '150px',
    selector: (row) => row.sort,
  },
  {
    name: '状态',
    minWidth: '150px',
    selector: (row) => row.status,
  },
  {
    name: '操作',
    width: '200px',
    selector: (row) => (
      <div
        className="column-action d-flex align-items-center"
        style={{ color: '#7367f0' }}
      >
        {/* <div className="ms-50 cursor-pointer">新增</div> */}
        <div
          className="ms-50 cursor-pointer"
          onClick={() => {
            handleEdit(row._id)
          }}
        >
          编辑
        </div>
        <div
          className="ms-50 cursor-pointer"
          onClick={() => {
            handleDelete(row._id)
          }}
        >
          删除
        </div>
      </div>
    ),
  },
]
